/**
 * Created by LXH on 2017/10/31.
 */
import axios from './axios.js'
import qs from 'qs'
import store from'../vuex/'
import {tl} from'../mixin/tool'
import {utility} from '../assets/js/utility/utility'

export const userService = {
    api: {},
    /* 获取个人中心 */
    myCenter: function () {
        return axios.get('/users/center')
    },
    // 支付宝支付
    myOrder:function (params) {
        return axios.put('/orders' + tl.getParam(params))
    },
    /* 校验VIp */
    isVip: function (params) {
        return axios.get('/isvip'+ tl.getParam(params))
    },
    /*  个人中心设置接口  */
    myCenterSet:function(params){
        return axios.post('/users/info',qs.stringify(params));
    },
    /*  个人中心设置地址接口  */
    myCenterAddress:function(params){
        return axios.get('/users/address'+ tl.getParam(params))
    },
    /*  绑定微信  */
    wxBind:function (code) {
        return axios.post('/tokens/wxbind',qs.stringify(code))
    },
    /*  个人中心设置地址编辑接口  */
    myAddressEdit:function(params){
        return axios.get('/users/address/'+ params);
    },
    /*  个人中心设置地址编辑保存接口  */
    myAddressSave:function(id,params){
        return axios.post('/users/address/' + id ,qs.stringify(params));
    },
    /*  个人中心设置地址新增保存接口  */
    myAddressNew:function(params){
        return axios.post('/users/address/',qs.stringify(params));
    },
    /*  个人中心设置地址删除接口  */
    myAddressDel:function(id){
        return axios.delete('/users/address/' + id);
    },
    /*  个人中心设置修改密码接口  */
    myPassword:function(params){
        return axios.put('/passwords/password' + tl.getParam(params));
    },
    /*  个人中心设置密码接口  */
    myPassword2:function(params){
        return axios.put('/passwords/set' + tl.getParam(params));
    },
    /*  个人中心设置修改头像接口  */
    myImage:function(params){
        return axios.post('/files/base64',qs.stringify(params));
    },
    /*  个人中心设置退出 接口 */
    myExit:function(){
        return axios.delete('/tokens');
    },
    /*  个人中心我的已购*/
    myBought:function(params){
        return axios.get('/users/bought' + tl.getParam(params) );
    },
    /*  个人中心我的活动*/
    myActivity:function(params){
        return axios.get('/orders/user' + tl.getParam(params) );
    },
    /*  个人中心我的收藏*/
    myCollect:function(params){
        return axios.get('/users/collect' + tl.getParam(params) );
    },
    /*  个人中心vipId查询*/
    vipLevel:function(id){
        return axios.get('/vips/' + id);
    },
    /*  个人中心消息*/
    getInformation:function(params){
        return axios.get('/innerletter' + tl.getParam(params));
    },
    /*  个人中心消息已读*/
    postInformation:function(params){
        return axios.post('/innerletter',qs.stringify(params));
    },
    /*  个人中心会员中心 */
    getvipLevel:function(){
        return axios.get('/vips/');
    },
    /*  个人中心兑换码 */
    getCode:function(params){
        return axios.post('/cdks/login',qs.stringify(params));
    },
    /*  评论接口（接收）  */
    getComments:function(params){
        return axios.get('/comments'+ tl.getParam(params));
    },
    /*  评论接口（发送）
     * id,parentId,type,typeId,typeTitle,
     * originalUserId,originalUserName,userId, userName,
     * userHeadImg,content,commentTime,top,show,admin,adminId
     * */
    postComments:function(param){
        return axios.post('/comments',qs.stringify(param));
    },
    /*  收藏接口 */
    getCollect:function(articleId,params){
        return axios.post('/articles/'+ articleId + '/collect',qs.stringify(params));
    },
    /*  点赞接口 */
    getLike:function(params){
        return axios.post('/cdks/login',qs.stringify(params));
    },
    /*  是否点赞收藏 */
    hasLike:function(params){
        return axios.get('/users/collect/exist'+ tl.getParam(params));
    },
    /*  点赞数（文章详情） */
    hasLikeNum:function(params){
        return axios.get('/articles/'+ params);
    },
    /*  点击赞/取消赞 */
    BtnLikeNum:function(id,params){
        return axios.post('/articles/'+ id +'/like',qs.stringify(params));
    },
    /*  点击收藏/取消点击收藏(文章) */
    BtnCollectNum:function(id,params){
        return axios.post('/articles/'+ id +'/collect',qs.stringify(params));
    },
    /*  点击收藏/取消点击收藏(活动) */
    BtnCollectAct:function(id,params){
        return axios.post('/activities/'+ id +'/collect',qs.stringify(params));
    },
    /*   微信状态下兑换码使用   */
    getUnionid:function(id){
        return axios.post('tokens/unionid',qs.stringify(id));
    },
    /* 添加浏览数 */
    addReadNo: function(shopId, typeId, params) {
        return axios.post('/read/' + typeId + '/inc', qs.stringify(params))
    },
    /* 添加浏览数 */
    getActivityOrders: function(params) {
        return axios.get('/orders/user/' + tl.getParam(params))
    },
    /*  确认支付页执行  */
    getOrders:function(params){
        return axios.get('/orders/'+ params);
    },
    /* （本地）下单请求订单号 */
    getOder: function (params) {
        return axios.post('/columns/order',qs.stringify(params))
    },
    /* （本地）获取订单内容 */
    getOderform: function (params) {
        return axios.post('/orders/',qs.stringify(params))
    },
    /*   订单详情页请求  */
    orderItem:function(id){
        return axios.get('/orders/' + id)
    },
    /*  支付宝接口  */
    getAlipay:function(params){
        return axios.put('/orders' + tl.getParam(params))
    },
    /* 微信配置 */
    getConfig:function(params){
        return axios.get('/wxconfig' + tl.getParam(params))
    },
    /*  获取微信授权地址  */
    getWxpay:function(params,loginType,platform,jumpRouter,wxscope){
        return axios.get('/tokens/oauth' + tl.getParam(params,loginType,platform,jumpRouter,wxscope))
    },
    /*   取消订单页  */
    noPay:function(orderNo,params){
        return axios.put('/orders/'+ orderNo +'/cancel' + tl.getParam(params));
    },
    /*  订单详情页退款 */
    orderRefund:function(orderNo,params){
        return axios.put('/orders/'+ orderNo +'/refundApply' + tl.getParam(params));
    },
    /*   电子票查询   */
    getTicket:function(orderNo){
        return axios.get('/mytickets/orderNo/'+ orderNo);
    },

    /* 活动确认订单 */
    getActivityOrder: function (activityId,params) {
        return axios.put('/lives/'+ activityId +'/detail' + tl.getParam(params));
    },
    /* 获取活动详情 */
    ActivityOrder: function (activityId,params) {
        return axios.get('/activities/'+ activityId +'/detail' + tl.getParam(params));
    },
    /* 活动去支付 */
    ActivityOrderPay: function (activityId,params) {
        return axios.post('/activities/'+ activityId +'/order' + tl.getParam(params),{responseType:'text'});
    },
    /* 知识订单 */
    getInfo: function (params) {
        return axios.get('/columns/detail' + tl.getParam(params));
    },
    /* 会员确认订单 */
    getVip: function (params) {
        return axios.put('/vips/orderconfirm' + tl.getParam(params));
    },
    /* 会员提交订单 */
    vipSubmit: function (params) {
        return axios.put('/vips/ordersubmit' + tl.getParam(params));
    },
    /* 直播确认订单 */
    getLivesOrder: function (watchNo,params) {
        return axios.put('/lives/'+ watchNo +'/detail' + tl.getParam(params));
    },
    /* 直播去支付 */
    LivesOrderPay: function (livesId,params) {
        return axios.put('/lives/' + livesId + '/order' + tl.getParam(params));
    },
    /* 获取列表 */
    getOrder: function (orderNo) {
        return axios.get('/orders/'+orderNo)
    },
    // 活动详情
    getActivities: function(params){
        return axios.get('/activities/'+params.activityId)
    },

    /*  个人中心会员中心列表 */
    getVips:function(){
        return axios.get('/vips');
    },
    /* 申请主办方 */
    postApplyadmin:function(params){
        return axios.post('/applyadmin',qs.stringify(params));
    },
    /* 查看名称是否可用 */
    getNamecheck:function(params){
        return axios.get('/namecheck' + tl.getParam(params));
    },
    /* 查看账号是否可用 */
    getAccountcheck:function(params){
        return axios.get('/accountcheck' + tl.getParam(params));
    },
    /* 是否已经申请主办方 */
    getIsApplyAdmin:function(params){
        return axios.get('/isApplyAdmin' + tl.getParam(params));
    },
}
// export default {loginService}
